Replaces odd scan lines with average of neighboring even lines. Can be used to improve the quality of images that have even and odd fields that are out of sync as the result of subject movement during capture.
}
var
i,width,height,row1,row2:integer;
begin
SaveState;
if NewWindow then Duplicate('Even Field');
GetPicSize(width,height);
row1:=0; row2:=0;
for i:=1 to height/2 do begin
GetRow(0,row1,width);
PutRow(0,row2,width);
row1:=row1+2;
row2:=row2+1;
end;
MakeRoi(0,0,width,height/2);
Copy;
MakeRoi(0,height/4-1,width,height/2);
Paste;
RestoreRoi;
SetScaling('Bilinear; Same Window');
ScaleAndRotate(1,2,0);
RestoreState;
end;
macro 'Extract Even Field->New Window';
begin
ExtractEvenField(true);
end;
macro 'Extract Even Field->Same Window';
begin
ExtractEvenField(false);
end;
macro 'Make Movie to Disk…';
{
Captures a specified number of images at a specified rate and
saves them to disk. Select an area of interest within the Camera
window before starting. Can be aborted with cmd-period.
}
var
nFrames,n,Left,Top,Width,Height:integer;
IntervalTicks,EndTicks,secs:integer;
begin
RequiresVersion(1.49);
GetRoi(Left,Top,Width,Height);
if width=0 then begin
PutMessage('First select the area of interest in the Camera window.');
exit;
end;
nFrames:=GetNumber('Number of Frames?',10);
IntervalTicks:=round(GetNumber('Delay Between Frames(seconds)?',60)*60);
EndTicks:=TickCount+IntervalTicks;
for n:=1 to nFrames do begin
StopCapturing;
MakeRoi(Left,Top,Width,Height);
SaveAs('Frame ',n);
StartCapturing;
while TickCount<EndTicks do begin
secs:=(EndTicks-TickCount) div 60;
ShowMessage(n:1,'/',nFrames,' ',secs:4)
end;
EndTicks:=EndTicks+IntervalTicks;
beep;
end;
StopCapturing;
end;
macro 'Camera and Light Source Test…';
{Use to test cameras and light sources for temporal stability.}
var
delay,nFrames:integer;
i:real;
begin
nFrames:=trunc(GetNumber('Number of Frames:',10));
delay:=trunc(GetNumber('Delay in seconds:',10));
for I:=1 to nFrames do begin
Capture;
Measure;
wait(delay);
end;
end;
macro 'Average Frames [A]';
begin
AverageFrames;
end;
macro 'Average Frames on Trigger';
begin
WaitForTrigger;
AverageFrames;
end;
macro 'Capture Frames…';
var
left,top,width,height,n,Camera,nFrames:integer;
begin
GetRoi(left,top,width,height);
if width=0 then begin
PutMessage('Please select an area of interest in the Camera window.');
exit;
end;
nFrames:=GetNumber('Number of frames:',4);
StartCapturing;
Camera:=nPics;
n:=0;
repeat
if Button then begin
MakeRoi(left,top,width,height);
n:=n+1;
Duplicate('Frame ',n:1);
SelectPic(Camera);
StartCapturing;
end;
until n=nFrames;
StopCapturing;
Dispose;
SetOption; TileWindows;
end;
macro 'Dynamic 1-D Plot';
{
Displays a dynamic 1-d plot of a line in the image while the image
is being captured. You most first create a line selection in
Camera window. The macro works best if you first to a Plot Profile
and move the Plot window so it doesn't cover the Camera window. You
may have to resize the Camera window. Hold down the mouse button
to terminate.
}
var
x1,y1,x2,y2,LineWidth:integer;
begin
GetLine(x1,y1,x2,y2,LineWidth);
if x1=-1 then begin
PutMessage('Create a straight line selection in the Camera window');
exit;
end;
SetPlotScale(0,255);
repeat
Capture;
if button then exit;
MakeLineRoi(x1,y1,x2,y2);
PlotProfile;
until button;
end;
macro 'Integrate Inverted…';
{
Inverts captured video to allow more than 128 frames to be
integrated without overflow. For example, the sum of 256 pixels
with an average value of 200(very dark) is 51,200, which is
greater than the 32,767 maximum, but the sum of 256 pixels
with and average value of 55(200 inverted) is 14,080.
}
var
nFrames:integer;
begin
nFrames:=GetNumber('Number of Frames:',200);
SetVideo('Invert');
AverageFrames('Integrate',nFrames);
SetVideo(''); {Don't invert}
Invert;
end;
macro '(-' begin end; {Menu divider}
{Note: keyboard shortcuts do not work when the Video}
{Control dialog box is the active window.}
macro 'SetChannel 1 [1]'; begin SetChannel(1) end;
macro 'SetChannel 2 [2]'; begin SetChannel(2) end;
macro 'SetChannel 3 [3]'; begin SetChannel(3) end;
macro 'SetChannel 4 [4]'; begin SetChannel(4) end;
macro '(-' begin end; {Menu divider}
macro 'Set LG-3 DAC A'; begin scion[1]:=GetNumber('DAC A(0-255):',scion[1]); end;
macro 'Set LG-3 DAC B'; begin scion[2]:=GetNumber('DAC B(0-255):',scion[2]); end;
macro 'Set LG-3 Data Out'; begin scion[4]:=GetNumber('Data Out(0-15):',scion[4]); end;
macro 'Read LG-3 Data In'; begin PutMessage('Data In=',BitAnd(scion[3],15):1); end;